<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org"
      xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity4">
<head>
    <meta charset="UTF-8">
    <title>Hello Spring Security</title>
</head>
<body>
<h1>Hello Spring Security</h1>
<p>这个界面没有受保护，你可以进已保护的界面</p>
<div th:fragment="logout" sec:authorize="isAuthenticated()"></div>
登录用户：<span sec:authentication="name"></span>
用户角色：<span sec:authentication="principal.authorities"></span>
<div>
    <form action="#" method="post" th:action="@{/logout}">
        <input type="submit" value="退出">
    </form>
</div>
</body>
</body>
</html>